import * as getters from './getters'
import * as actions from './actions'
import mutations from './mutations'

//  const 声明 一个常量才不会导致每次刷新会改变 store 的值
const state = {
  load: false,
  webchatList: {
    sortType: 'lastCustomerMsgTimeStamp',
    webchat_todo: {
      init: false,
      list: [], // 列表
      count: 0 // 结果数量
    },
    webchat_all: {
      list: [], // 列表
      count: 0 // 结果数量
    },
    webchat_robot: {
      list: [], // 列表
      count: 0 // 结果数量
    },
    webchat_queue: {
      list: [], // 列表
      count: 0 // 结果数量
    },
    webchat_laterProcess: {
      list: [], // 列表
      count: 0 // 结果数量
    }
  },
  autoCust: {},
  onlineAgents: [],
  isOn: 'open',
  isOnOld: '',   // 来电时候的状态，在挂断的时候还原
  queueNum: 0,
  todoNum: 0, // 待处理数
  onTimeSearch: false, // 是否处于时间检索中
  currentUser: {},
  ubaInfoList: {}, // 浏览轨迹
  webchatConLoading: true,
  webchatConRandom: '',
  ubaInfoListAll: {}, // 全部的浏览轨迹
  preload: {}, // 访客消息预加载
  refreshWebchatSummary: 0,
  lastContent: {},
  nowTimeDiff: 0,
  undealNumTimeStamp: 0,
  emoticonNumber: 0, // 表情包数量
  sessionFormList: [], // 表情包数量
  current: {// 当前会话
    shwoInvite: {},
    webchat_todo: {
      previousSessionPlatform: '',
      currentOpenSession: '',
      shwoInviteBtn: true,
      inviteUserName: '',
      inviteSessionId: '',
      currentSession: {},
      messageList: {},
      messageListChange: {},
      currentCustomer: {},
      chatInfoById: {},
      todoShowConfig: {},
      sysQuickReply: [], // 系统公用快捷回复
      customQuickReply: {}, // 自定义快捷回复
      customQuickReplySort: [], // 自定义快捷回复分类
      allQuickReply: {
        list: [],
        flag: true
      }, // 全部快捷回复
      visitInfoList: {}, // 访问信息
      // ubaInfoListAll: {}, // 全部的浏览轨迹
      historyMsgList: {},
      sessionFormHistory: {},
      timerList: [],
      funTabInfo: {} // Funtab记录
    },
    webchat_all: {// 同上
      messageList: [],
      currentSession: {},
      currentCustomer: {},
      chatInfoById: {},
      todoShowConfig: {},
      historyMsgList: [],
      sessionFormHistory: {},
      visitInfoList: [] // 访问信息
    },
    webchat_robot: {// 同上
      messageList: [],
      currentSession: {},
      currentCustomer: {},
      chatInfoById: {},
      todoShowConfig: {},
      sessionFormHistory: {},
      historyMsgList: [],
      visitInfoList: [] // 访问信息
    },
    webchat_queue: {// 同上
      messageList: [],
      currentSession: {},
      currentCustomer: {},
      chatInfoById: {},
      sessionFormHistory: {},
      todoShowConfig: {},
      historyMsgList: [],
      visitInfoList: [] // 访问信息
    },
    webchat_laterProcess: {// 同上
      messageList: [],
      currentSession: {},
      currentCustomer: {},
      chatInfoById: {},
      todoShowConfig: {},
      historyMsgList: [],
      sessionFormHistory: {},
      visitInfoList: [] // 访问信息
    },
    refreshWebchatRight: 0
  },
  inviteUbaSessionList: { // 主动会话列表
    list: [],
    tableList: []
  },
  transCache: {// 公共
    closeWebchatRight: true,
    // 在线咨询知识库搜索
    setImSearchValue: {
      value: '',
      random: ''
    },
    // 点击搜索到的文本复制到发送框
    copyImSearchValue: {
      value: '',
      random: ''
    },
    qualityCheck: {
      messageList: [],
      page: '',
      finishChatScroll: false
    }
  },
  isinviteVideo: false,
  invitePersonnel: 'customer',
  isVideoing: false,
  hideVideoCamera: false,
  videoChatData: {
    videoSessionid: '',
    videoToken: '',
    videoUsername: '',
    videoSource: '',
    roomId: '',
    refreshFlag: ''
  },
  videoInvitedData: {
    videoInviteUsername: '',
    videoInviteToken: '',
    videoInviteSessionid: '',
    roomId: '',
    videoType: '',
    password: ''
  },
  isShareScreening: false,
  shareScreenSessionid: '',
  shareScreenCustName: '',
  renderWebchatContainer: '',
  trackMovie: {
    movieId: '',
    framesId: '',
    movieList: [],
    framesList: {},
    player: null,
    isPlaying: false,
    speed: 1,
    movie: {
      index: 0,
      duration: 0
    }
  }
  // endSessionLength: 0
}
export default {
  state,
  getters,
  actions,
  mutations
}
